rem
	bbdoc: Type description
end rem
Import maxgui.maxgui

Type ScintillaAbstractDriver Abstract
	Field _Notify(area:Object, wp:Int, lp:Int)
	Field _parent:Object
	 
	Method Init(panel:TGadget) Abstract	
	Method SendEditor:Int(MSG:Int, wParam:Int = 0, lParam:Int = 0) Abstract
	Method IsNullDriver:TGadget() Abstract
	Method DoPrint() Abstract
	
	Method SetNotfiyHandler(area:Object, _n(area:Object, wp:Int, lp:Int))
		_Notify = _n
		_parent = area
	End Method
	
	Method OnNotify(wp:Int, lp:Int)
		If _Notify <> Null And _parent <> Null Then _Notify(_parent, wp, lp)
	End Method
	Rem
	bbdoc: SENDEDITORSTRING
	End Rem
	Method SendEditorString:Int(MSG:Int, wParam:Int, lParam:String)
		Local p:Byte Ptr = lparam.toCString()
		Local Result:Int = SendEditor(MSG, wParam, Int p)
		MemFree(p)
		Return Result
	End Method
	

	Rem
	bbdoc: SENDEDITORSTRINGSTRING
	End Rem
	Method SendEditorStringString:Int(msg:Int , wParam:String , lParam:String)
		Local w:Byte Ptr = wparam.toCString()
		Local l:Byte Ptr = lparam.toCString()
		Local Result:Int = SendEditor(MSG, Int w, Int l)
		MemFree(w)
		MemFree(l)
		Return Result
	End Method
	
	Rem
	bbdoc: RECEIVEEDITORSTRING
	End Rem
	Method ReceiveEditorString:String(msg:Int , Length:Int )
		Local chars:Byte[] = New Byte[length]
		SendEditor(MSG, Length, Int Byte Ptr(chars))
		
		Local text:String = ""
		If length > 1
			text = String.FromBytes(chars,length-1)
		End If

		Return text
	End Method
	
	Rem
	bbdoc: RECEIVEEDITORSTRING
	End Rem
	Method ReceiveEditorDataString:String(msg:Int ,data:Int, Length:Int )
		Local chars:Byte[] = New Byte[length]
		SendEditor(msg , data, Int Byte Ptr(chars) )
		Local text:String = ""
		If length > 1
			text = String.FromBytes(chars,length-1)
		End If
		
		Return text
	End Method
End Type
